import { INCREMENT,DECREMENT } from "../constants/countConst"
const init={
    count:0
}
export default function count(prevState=init,action){
    const {type,data}=action
    switch(type){
        case INCREMENT:
            return {...init,count:prevState.count+data}
        case DECREMENT:
            return {...init,count:prevState.count-data}
    }
    return prevState
}